import 'package:backend.core/core/domain/entities/app_store/app_store_transaction_revocation_reason.dart';
import 'package:backend.purchases/domain/entities/app_store_api/app_store_api_transaction_revocation_reason.dart';

abstract class CreateAppStoreTransactionRevocationReasonFromApiOne {
  AppStoreTransactionRevocationReason call({
    required AppStoreApiTransactionRevocationReason apiRevocationReason,
  });
}

class CreateAppStoreTransactionRevocationReasonFromApiOneImpl
    implements CreateAppStoreTransactionRevocationReasonFromApiOne {
  const CreateAppStoreTransactionRevocationReasonFromApiOneImpl();

  @override
  AppStoreTransactionRevocationReason call({
    required AppStoreApiTransactionRevocationReason apiRevocationReason,
  }) {
    switch (apiRevocationReason) {
      case AppStoreApiTransactionRevocationReason.issueWithinApp:
        return AppStoreTransactionRevocationReason.issueWithinApp;
      case AppStoreApiTransactionRevocationReason.otherReason:
        return AppStoreTransactionRevocationReason.otherReason;
    }
  }
}
